<template>
	<view class="contont" style="background-color: #F5F5F5;">
		<view style="background-color: #FFFFFF;height:100%;width: 100%;" v-if="vehi==0">
					<view style="width: 200px;height: 200px;background-image: url(../../static/img/pic_zwcl@2x.png);background-size: 100% 100%;font-size: 15px;color: #042A58;display: flex;align-items: flex-end;justify-content: center;margin-top: 39px;margin-left: 88px;">
			您还没有添加过车辆哦~
			<button>
				添加车辆信息
			</button>
		</view>
		</view>

		<view style="width: 355px;height: 95px;margin-top: 10px;border-radius:8px;background-color: #FFFFFF;" class="cent" v-if="vehi==1" @click="but">
			<view style="display: flex;justify-content: space-between;align-items: center;" >
				<image src="../../static/img/icon_jiqiache@2x.png" mode="" style="width: 45px;height: 45px;margin-left: 15px;margin-right: 15px;"></image>
				<view style="flex-direction: column;display: flex;justify-content: space-between;">
									<view style="font-size: 18px;color: #042A58;">{{list.carnum}}</view>
				<view style="margin-top: 6px;font-size: 15px;color: #97A9BF;">
					<text>{{list.carmodel}}</text>
					<text style="margin-left: 22px;">{{list.carlenth}}m</text>
				</view>
				</view>

			</view>
			<view style="font-size: 15px;color: #042A58;height: 50%;margin-right: 15px;">
				<text  v-if="list.carStatus==1" style="color: #002CFF;">
					审核中
				</text>
				<text  v-if="list.carStatus==2" style="color: #002CFF;">
					认证失败
				</text>
				<text  v-if="list.carStatus==3" style="color: #002CFF;">
					已过期
				</text>
				<text  v-if="list.carStatus==4" style="color: #002CFF;">
					快过期
				</text>
				<text  v-if="list.carStatus==5" style="color: #002CFF;">
					已认证
				</text>
			</view>
		</view>
		<button v-if="vehi==0" @click="buted">
			添加车辆信息
		</button>
		<button v-if="vehi==1" style="background-color: #DAE0E7;color: #FFFFFF;" >
			添加车辆信息
		</button>
	</view>
</template>

<script>
	import {ajax} from '../../api.js'
	export default {
		data() {
			return {
			vehi:0,
			list:[]
			
			}
		},
		onShow() {
			var that=this
uni.showLoading({
  title: '加载中...',
})
		ajax({
			url:"/v1/appdriver/user/carprofile",
			method:"post",
			success(res){
				
				if(res.data.message.carnum==""){
						uni.hideLoading()
					that.vehi=0
				}else{
				uni.hideLoading()
					that.list=res.data.message
					that.vehi=1
				}
			}
		})
		},
		methods: {
		but(){
			console.log(123)
			if(this.list.carStatus==2){
				uni.navigateTo({
					url:"../cart/carting?id=1"
				})
			}else{
				uni.navigateTo({
					url:"../cart/caer"
				})
			}
		},
		buted(){
			uni.navigateTo({
				url:"../cart/cart"
			})
		}
		}
	}
</script>

<style>
	button{
		width:345px;
		height:44px;
		background:rgba(4,42,88,1);
		border-radius:8px;
		position: fixed;
		bottom: 30px;
		color: #FFFFFF;
	}
	page{
		height: 100%;
	}
</style>
